package com.nufront.bloodsugar.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.nufront.bloodsugar.R;

public class DragButtonView extends LinearLayout {

	private Context mContext;
	private LayoutInflater layoutInflater;
	private View mView;
	private TextView mTxtButton;
	private Drawable txtBtBg;

	public DragButtonView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		mContext = context;
		TypedArray a = mContext.obtainStyledAttributes(attrs,
				R.styleable.MyDragButton);
		txtBtBg = a.getDrawable(R.styleable.MyDragButton_txtButtonBg);
		layoutInflater = LayoutInflater.from(mContext);
		initView();
		this.addView(mView);
	}

	public DragButtonView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	private void initView() {
		mView = layoutInflater.inflate(R.layout.drag_button_layout, null);

		mTxtButton = (TextView) mView.findViewById(R.id.mButton);
		mTxtButton.setBackgroundDrawable(txtBtBg);
	}

}
